package com.fly.caihong.adapter;

import android.widget.ImageView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.fly.caihong.R;
import com.fly.caihong.model.MallTopicItem;
import com.fly.caihong.utils.ApUtils;
import com.fly.caihong.utils.GlideUtils;
import com.fly.caihong.utils.SizeUtils;

import java.util.ArrayList;
import java.util.List;


public class HomeMallAdapter extends BaseQuickAdapter<MallTopicItem, BaseViewHolder> {
    public HomeMallAdapter(List<MallTopicItem> dataList) {
        super(R.layout.layout_mall_topic_item, dataList == null ? new ArrayList<MallTopicItem>() : dataList);
    }

    @Override
    protected void convert(BaseViewHolder helper, MallTopicItem item) {
        int position = helper.getAdapterPosition();
        if (position % 2 == 1) {
            helper.getConvertView().setPadding(SizeUtils.dp2px(10), 0, 0, 0);
        } else {
            helper.getConvertView().setPadding(0, 0, SizeUtils.dp2px(10), 0);
        }
        GlideUtils.loadSrcImage(ApUtils.getApp(), (ImageView) helper.getView(R.id.iv_img), item.getPictures());
    }
}
